package com.example.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.websocket.Session;

@Controller
public class Other {

    /**
     * 字符串拼接
     * @param model
     * @return
     */
    @RequestMapping(value = "/splice")
    public String splice(Model model) {
        model.addAttribute("totalRows",123);
        model.addAttribute("totalPage",13);
        model.addAttribute("currentPage",2);
        return "splice";
    }



    /**
     * Session和Request
     * @param model
     * @return
     */
    @RequestMapping(value = "/ss")
    public String sessionAndRequest(String sstemp,Model model, HttpSession session, HttpServletRequest httpServletRequest) {
//        session 是setAttribute
        session.setAttribute("sessionParm","sessionValue");
        httpServletRequest.getSession().setAttribute("sstemp",sstemp);
//        无数据
        httpServletRequest.setAttribute("requestParm","requestAttribute");
//        httpServletRequest是getParameter
//        httpServletRequest.getParameter("requestParm");
        model.addAttribute("requestModel","requestModelValue");
//        return "kong2";
        return "splice";
    }



}
